package com.coocaa.ops.api.v1.content;

import com.coocaa.ops.api.common.model.ResponseData;
import com.coocaa.ops.api.common.util.RequestUtil;
import com.coocaa.ops.api.common.util.ResponseUtil;
import com.coocaa.ops.api.v1.content.model.query.TabQueryModel;
import com.coocaa.ops.api.v1.content.model.output.TabContent;
import com.coocaa.ops.api.v1.content.service.ITabService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

/**
 * @author zen
 * @date 2020-06-18 17:16
 * @description
 */
@Slf4j
@RestController
@RequestMapping("/tvos")
public class TabController {

    @Autowired
    @Qualifier("tabServiceImpl")
    private ITabService tabService;
    /**
     *  获取版面内容
     * @param request 请求数据
     * @return 版面内容
     */
    @RequestMapping(value = "/getTabContent", method = RequestMethod.GET)
    public ResponseData<TabContent> getTabContent(HttpServletRequest request, TabQueryModel tabQueryModel) {
        TabContent data = tabService.getTabContent(RequestUtil.getHeader(request), tabQueryModel);
        return ResponseUtil.renderSuccess("success", data);
    }


}
